package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import com.example.myapplication.Adapter.ViewPagerAdapter;

import java.util.ArrayList;
import java.util.List;

public class ViewPagerActivity extends AppCompatActivity {

    private ViewPager viewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view_pager);

        LayoutInflater layoutInflater = getLayoutInflater().from(this);
        View view1 = layoutInflater.inflate(R.layout.vp_layout1, null);
        View view2 = layoutInflater.inflate(R.layout.vp_layout2, null);
        View view3 = layoutInflater.inflate(R.layout.vp_layout3, null);

        viewPager = findViewById(R.id.vp);

        List<View> list = new ArrayList<>();
        list.add(view1);
        list.add(view2);
        list.add(view3);

        ViewPagerAdapter adapter = new ViewPagerAdapter(list);
        viewPager.setAdapter(adapter);
    }
}